function ZM = zernikefunc(n_max,j_max,r,theta)

% length of input vectors of theta and r
lent = length(r);

% ---calculate the value of triangle polynomials---
% -------------------------------------------------
TM = angular(j_max,lent,theta);

%---calculate the Radial Polynomials R_nm---
%-------------------------------------------
RM = Barmak(j_max,n_max,lent,r);

ZM = TM.*RM;

% end of function
end